package chen.web.antispam;

/**
 * 
 * 一定时间内的最大次数规则.
 * 比如60秒钟内最多3次，那么时间范围是60秒，最大次数是3
 * @author chen
 *
 */
public class Regulation {

	private int maxTimes;		//最大次数
	private int timeRange;		//时间范围，单位秒
		
	public Regulation(int timeRange, int maxTimes){
		if(maxTimes < 0){
			throw new IllegalArgumentException("最大次数不正确");
		}
		this.maxTimes = maxTimes;
		if(timeRange <= 0){
			throw new IllegalArgumentException("时间范围不正确");
		}
		this.timeRange = timeRange;
	}

	public int getTimeRange() {
		return timeRange;
	}

	public int getMaxTimes() {
		return maxTimes;
	}
}
